/*    */ package server.carnival;
/*    */ 
/*    */ import client.MapleDisease;
/*    */ import java.io.File;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ import provider.MapleData;
/*    */ import provider.MapleDataProvider;
/*    */ import provider.MapleDataProviderFactory;
/*    */ import provider.MapleDataTool;
/*    */ import server.life.MobSkill;
/*    */ import server.life.MobSkillFactory;
/*    */ 
/*    */ 
/*    */ public class MapleCarnivalFactory
/*    */ {
/* 17 */   private static final MapleCarnivalFactory instance = new MapleCarnivalFactory();
/* 18 */   private final Map<Integer, MCSkill> skills = new HashMap<>();
/* 19 */   private final Map<Integer, MCSkill> guardians = new HashMap<>();
/* 20 */   private final MapleDataProvider dataRoot = MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Skill.wz"));
/*    */ 
/*    */   
/*    */   public MapleCarnivalFactory() {
/* 24 */     initialize();
/*    */   }
/*    */   
/*    */   public static MapleCarnivalFactory getInstance() {
/* 28 */     return instance;
/*    */   }
/*    */   
/*    */   private void initialize() {
/* 32 */     if (!this.skills.isEmpty()) {
/*    */       return;
/*    */     }
/* 35 */     for (MapleData z : this.dataRoot.getData("MCSkill.img")) {
/* 36 */       this.skills.put(Integer.valueOf(Integer.parseInt(z.getName())), new MCSkill(MapleDataTool.getInt("spendCP", z, 0), MapleDataTool.getInt("mobSkillID", z, 0), MapleDataTool.getInt("level", z, 0), (MapleDataTool.getInt("target", z, 1) > 1)));
/*    */     }
/* 38 */     for (MapleData z : this.dataRoot.getData("MCGuardian.img")) {
/* 39 */       this.guardians.put(Integer.valueOf(Integer.parseInt(z.getName())), new MCSkill(MapleDataTool.getInt("spendCP", z, 0), MapleDataTool.getInt("mobSkillID", z, 0), MapleDataTool.getInt("level", z, 0), true));
/*    */     }
/*    */   }
/*    */   
/*    */   public MCSkill getSkill(int id) {
/* 44 */     return this.skills.get(Integer.valueOf(id));
/*    */   }
/*    */   
/*    */   public MCSkill getGuardian(int id) {
/* 48 */     return this.guardians.get(Integer.valueOf(id));
/*    */   }
/*    */   
/*    */   public static class MCSkill
/*    */   {
/*    */     public final int cpLoss;
/*    */     public final int skillid;
/*    */     public final int level;
/*    */     public final boolean targetsAll;
/*    */     
/*    */     public MCSkill(int _cpLoss, int _skillid, int _level, boolean _targetsAll) {
/* 59 */       this.cpLoss = _cpLoss;
/* 60 */       this.skillid = _skillid;
/* 61 */       this.level = _level;
/* 62 */       this.targetsAll = _targetsAll;
/*    */     }
/*    */     
/*    */     public MobSkill getSkill() {
/* 66 */       return MobSkillFactory.getMobSkill(this.skillid, 1);
/*    */     }
/*    */     
/*    */     public MapleDisease getDisease() {
/* 70 */       if (this.skillid <= 0) {
/* 71 */         return MapleDisease.getRandom();
/*    */       }
/* 73 */       return MapleDisease.getBySkill(this.skillid);
/*    */     }
/*    */   }
/*    */ }


/* Location:              C:\PGX\Server.jar!\server\carnival\MapleCarnivalFactory.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */